home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 2 / ETO Development Tools 2.iso / Tools - Objects / MacApp / MacApp CD Release / MacApp 2.0.1 (Many Libraries) / Interfaces / PInterfaces / UTEView.p < prev    next >
Encoding:
Text File  |  1990-10-25  |  24.2 KB  |  666 lines  |  [TEXT/MPS ]

  1. {[a-,body+,h-,o=100,r+,rec+,t=4,u+,#+,j=20/57/1$,n-]}
  2. { UTEView.p }
  3. { Copyright © 1986-1990 Apple Computer, Inc.  All rights reserved. }
  4.  
  5. {$IFC UNDEFINED UsingIncludes}
  6. {$SETC UsingIncludes := FALSE}
  7. {$ENDC}
  8.  
  9. {$IFC NOT UsingIncludes}
  10. UNIT UTEView;
  11.  
  12.     INTERFACE
  13.         {$ENDC}
  14.  
  15.         {$IFC UNDEFINED __TEView__}
  16.         {$SETC __TEView__ := FALSE}
  17.         {$ENDC}
  18.  
  19.         {$IFC NOT __TEView__}
  20.         {$SETC __TEView__ := TRUE}
  21.  
  22.         { • Auto-Include the requirements for this unit's interface. }
  23.         {$SETC UTEViewIncludes := UsingIncludes}
  24.         {$SETC UsingIncludes := TRUE}
  25.         {$I+}
  26.         {$IFC UNDEFINED __UMacApp__} {$I UMacApp.p} {$ENDC}
  27.         {$SETC UsingIncludes := UTEViewIncludes}
  28.  
  29.         CONST
  30.             kUnlimited            = MAXINT;                { The maximum number of characters in the
  31.                                                          fText of a TTEView object }
  32.  
  33.             kWithStyle            = TRUE;                 { Parameters to TTEView.ITEView }
  34.             kWithoutStyle        = FALSE;
  35.             kSaveCurrentChars    = TRUE;                 { Parameter to ITECommand }
  36.  
  37.             Chr00                = CHR(0);                { Needed for ControlCharSet }
  38.             Chr1F                = CHR($1F);
  39.  
  40.             kMinAhead            = 96;                    { Default value for fMinAhead }
  41.  
  42.  
  43.         TYPE
  44.             ControlCharSet        = SET OF Chr00..Chr1F;
  45.  
  46.             TEViewTemplate        = PACKED RECORD
  47.                 itsStyleType:        BOOLEAN;
  48.                 itsAutoWrap:        BOOLEAN;
  49.                 itsAcceptsChanges:    BOOLEAN;
  50.                 itsFreesText:        BOOLEAN;
  51.                 filler1:            0..4095;
  52.                 itsKeyCmdNumber:    INTEGER;
  53.                 itsMaxChars:        INTEGER;
  54.                 itsInset:            Rect;
  55.                 itsJustification:    INTEGER;
  56.                 itsTextFace:        Style;
  57.                 itsTextSize:        INTEGER;
  58.                 itsTextColor:        RGBColor;
  59.                 itsFontName:        Str255;             { Actually a variable length P-String }
  60.                 END;
  61.             TEViewTemplatePtr    = ^TEViewTemplate;
  62.  
  63.             {$IFC qHasForward}
  64.             TTECommand             = OBJECT;    FORWARD;
  65.             TTETypingCommand    = OBJECT;    FORWARD;
  66.             TTEStyleCommand         = OBJECT;    FORWARD;
  67.             {$EndC}
  68.  
  69.             TTEView             = OBJECT (TView)        { TTEView is a view subclass representing a
  70.                                                          TextEdit record. TextEdit is the simple
  71.                                                          text-editing facility built into the
  72.                                                          Macintosh ROM. The purpose of a TEView is
  73.                                                          to make TextEdit function properly in a
  74.                                                          MacApp environment, for things like
  75.                                                          scrolling, printing, page breaks, and
  76.                                                          command handling }
  77.  
  78.                 fHTE:                TEHandle;            { Handle to the actual TextEdit object }
  79.  
  80.                 fText:                Handle;             { The text in the TEHandle }
  81.                 fSavedTEHandle:     Handle;             { Saved handle from TENew }
  82.  
  83.                 fInset:             Rect;                { Amount to inset text from edges of view }
  84.  
  85.                 fKeyCmdNumber:        CmdNumber;            { Will be used as the string number for
  86.                                                          "Undo Typing" }
  87.  
  88.                 fMaxChars:            INTEGER;            { Maximum number of chars to accept into
  89.                                                          fText. Default is MAXINT; stuff to
  90.                                                          different value if you want to limit max
  91.                                                          chars to fewer than MAXINT }
  92.  
  93.                 fLastHeight:        LONGINT;            { Last checked height of record. If the
  94.                                                          record is stylish, this represents the
  95.                                                          height in pixels. For old-style records,
  96.                                                          equals number of lines. }
  97.  
  98.                 fLastWidth:        LONGINT;                { Last checked width of record. Not currently
  99.                                                         used If the TE is styled, this represents the
  100.                                                         width in pixels. }
  101.  
  102.                 fTypingCommand:     TTETypingCommand;    { The current TE Typing command relating to
  103.                                                          me, if any }
  104.  
  105.                 fTextStyle:         TextStyle;            { Current style of text }
  106.  
  107.                 fJustification:     INTEGER;            { Current justification of text record }
  108.  
  109.                 fAcceptsChanges:    BOOLEAN;            { Set to FALSE to have text which will not
  110.                                                          accept any change, such as text on the
  111.                                                          Clipboard, or perhaps received mail }
  112.                 fStyleType:         BOOLEAN;            { Set to kWithStyle if record is styled }
  113.                 fAutoWrap:            BOOLEAN;            { Set to FALSE for line wrapping at CR's
  114.                                                          only }
  115.                 fFreeText:            BOOLEAN;            { Determines if fText should be freed on
  116.                                                          Free. }
  117.                 fSpecsChanged:        BOOLEAN;            { Something recently happened which could
  118.                                                          effect font/style/size/color menu item
  119.                                                          updating. Should be reset to FALSE when
  120.                                                          application has taken the appropriate
  121.                                                          action. }
  122.                 fLastPageBreak:     INTEGER;            { Caches last page break computed. }
  123.                 fLastLine:            INTEGER;            { Last line of text of the last page break }
  124.                 fControlChars:        ControlCharSet;        { Control chars accepted in text }
  125.                 fMinAhead:            INTEGER;            { Minimum amount by which to autoscroll ahead
  126.                                                         when scrolling selection into view.  (When typing
  127.                                                         etc. }
  128.  
  129.                                 { Initialize and Free }
  130.  
  131.                 PROCEDURE TTEView.ITEView(itsDocument: TDocument; { OK to be NIL, if view will
  132.                                                                    belong to a documentless window
  133.                                                                    }
  134.                                           itsSuperView: TView; { The view in which this view is
  135.                                                                 contained }
  136.                                           itsLocation: VPoint; { Location in its superview }
  137.                                           itsSize: VPoint; { Size of view }
  138.                                           itsHDeterminer: SizeDeterminer; { How to width of the view
  139.                                                                            is to be determined }
  140.                                           itsVDeterminer: SizeDeterminer; { How the height of the
  141.                                                                            view is to be determined
  142.                                                                            }
  143.                                           itsInset: Rect; { Amount to inset text }
  144.                                           itsTextStyle: TextStyle; { Initial text style }
  145.                                           itsJustification: INTEGER; { Its justification }
  146.                                           itsStyleType: BOOLEAN; { Whether or not record is styled }
  147.                                           itsAutoWrap: BOOLEAN { FALSE if newline occurs at CR only
  148.                                                                 }
  149.                                           );
  150.                 { For Initialization of procedurally created TEView. }
  151.  
  152.                 PROCEDURE TTEView.IRes(itsDocument: TDocument;
  153.                                        itsSuperView: TView;
  154.                                        VAR itsParams: Ptr); OVERRIDE;
  155.                 { Initialize a TTEView via a 'view' resource. }
  156.  
  157.                 PROCEDURE TTEView.WRes(theResource: ViewRsrcHndl;
  158.                                        VAR itsParams: Ptr); OVERRIDE;
  159.                 { Write the object out to a view resource. }
  160.  
  161.                 PROCEDURE TTEView.WriteRes(theResource: ViewRsrcHndl;
  162.                                            VAR itsParams: Ptr); OVERRIDE;
  163.                 { Set up the type and signature of this object and call WRes. }
  164.  
  165.                 PROCEDURE TTEView.Free; OVERRIDE;
  166.                 { Frees the TERecord and optionally fText, then frees SELF }
  167.  
  168.                 PROCEDURE TTEView.MakeTERecord;
  169.                 { Called with grafport properly set, to create the actual TE Record }
  170.  
  171.                 { Commands and Menus }
  172.  
  173.                 FUNCTION TTEView.DoKeyCommand(ch: Char;
  174.                                               aKeyCode: INTEGER;
  175.                                               VAR info: EventInfo): TCommand; OVERRIDE;
  176.                 { Handles keystrokes }
  177.  
  178.                 FUNCTION TTEView.DoMakeEditCommand(aCmdNumber: CmdNumber): TTECommand;
  179.                 { Make a command for handling edit menu stuff }
  180.  
  181.                 FUNCTION TTEView.DoMakeStyleCommand(aStyle: TextStyle;
  182.                                                     itsCmdNumber: CmdNumber;
  183.                                                     itsMode: INTEGER): TTEStyleCommand;
  184.                 { Make a style change command }
  185.  
  186.                 FUNCTION TTEView.DoMakeTypingCommand(ch: Char): TTETypingCommand;
  187.                 { Make a typing command for handling keystrokes }
  188.  
  189.                 FUNCTION TTEView.DoMenuCommand(aCmdNumber: CmdNumber): TCommand; OVERRIDE;
  190.                 { Handles menu commands }
  191.  
  192.                 FUNCTION TTEView.DoMouseCommand(VAR theMouse: Point;
  193.                                                 VAR info: EventInfo;
  194.                                                 VAR hysteresis: Point): TCommand; OVERRIDE;
  195.                 { Handles mousepresses }
  196.  
  197.                 PROCEDURE TTEView.DoneTyping;
  198.                 { No further typing can occur for the current typing command }
  199.  
  200.                 PROCEDURE TTEView.DoSetupMenus; OVERRIDE;
  201.                 { Sets up menus }
  202.  
  203.                 PROCEDURE TTEView.InstallSelection(wasActive, beActive: BOOLEAN); OVERRIDE;
  204.                 { Called at activate/deactivate time to get insertion-point-blinking right (or to
  205.                 highlight the selection) }
  206.  
  207.                 PROCEDURE TTEView.ViewEnable(state, redraw: BOOLEAN); OVERRIDE;
  208.                 { Resets the view's idle }
  209.  
  210.                 { Screen Display }
  211.  
  212.                 FUNCTION TTEView.DoIdle(phase: IdlePhase): BOOLEAN; OVERRIDE;
  213.                 { Blinks the insertion point }
  214.  
  215.                 FUNCTION TTEView.DoSetCursor(localPoint: Point;
  216.                                              cursorRgn: RgnHandle): BOOLEAN; OVERRIDE;
  217.                 { Sets the cursor to the I-beam }
  218.  
  219.                 PROCEDURE TTEView.Draw(area: Rect); OVERRIDE;
  220.                 { Draw the text in a frame or on the printed page }
  221.  
  222.                 PROCEDURE TTEView.ShowReverted; OVERRIDE;
  223.                 { Make sure line starts are correct before redisplay }
  224.  
  225.                 { Size Changes }
  226.  
  227.                 PROCEDURE TTEView.BeInPort(itsPort: GrafPtr); OVERRIDE;
  228.                 { Now that a grafport is established for the view, tells TextEdit about it }
  229.  
  230.                 PROCEDURE TTEView.BeInScroller(itsScroller: TScroller); OVERRIDE;
  231.                 { Gives us a chance to set the scroll parameters }
  232.  
  233.                 PROCEDURE TTEView.CalcMinSize(VAR minSize: VPoint); OVERRIDE;
  234.                 { Compute the minimum size of the view }
  235.  
  236.                 FUNCTION TTEView.CalcRealHeight: LONGINT;
  237.                 { Calculate true height of record, including last character if it is a carriage
  238.                 return }
  239.  
  240.                 FUNCTION TTEView.CalcRealWidth: LONGINT;
  241.                 { Calculate true width of record.  Only supported for NON-styled TE Records right now }
  242.  
  243.                 PROCEDURE TTEView.ComputeSize(VAR newSize: VPoint); OVERRIDE;
  244.                 { Compute the actual size of the view }
  245.  
  246.                 PROCEDURE TTEView.Resize(width, height: VCoordinate;
  247.                                          invalidate: BOOLEAN); OVERRIDE;
  248.                 { Installs the new size for both the View and TextEdit }
  249.  
  250.                 PROCEDURE TTEView.SynchView(redraw: BOOLEAN);
  251.                 { Keeps view metrics in synch after TextEdit operation. If redraw is true then
  252.                 ScrollSelectionIntoView is called to make sure the selection is visible.}
  253.  
  254.                 { Clipboard }
  255.  
  256.                 { NOTE -- These methods apply only to a TEView installed as the view in the Clipboard
  257.                 }
  258.  
  259.                 FUNCTION TTEView.ContainsClipType(aType: ResType): BOOLEAN; OVERRIDE;
  260.                 { Determines whether the indicated clipboard type can be produced by the view }
  261.  
  262.                 FUNCTION TTEView.GivePasteData(aDataHandle: Handle;
  263.                                                dataType: ResType): LONGINT; OVERRIDE;
  264.                 { Supplies data to be PASTED by some requesting PASTE command }
  265.  
  266.                 PROCEDURE TTEView.WriteToDeskScrap; OVERRIDE;
  267.                 { Produces TEXT data for the Desk Scrap when called upon to do so }
  268.  
  269.                 { Miscellaneous }
  270.  
  271.                 PROCEDURE TTEView.AutoScrolling(doScrolling: BOOLEAN);
  272.                 { Set TERecord auto scrolling to given value via TEAutoScroll }
  273.  
  274.                 FUNCTION TTEView.ClikLoop: BOOLEAN;
  275.                 { Forwarded to from the global routine: ClickLoopForTTEView which was set as the
  276.                 TE's ClikLoop.  Typically handles autoscrolling for the view. }
  277.  
  278.                 PROCEDURE TTEView.CalcSelLoc(VAR selectionRect: Rect);
  279.                 { Calculates the location of the current Selection }
  280.  
  281.                 PROCEDURE TTEView.ChangeWrap(newAutoWrap, redraw: BOOLEAN);
  282.                 { Changes auto-wrapping behavior, redrawing if requested }
  283.  
  284.                 FUNCTION TTEView.ContinuousStyle(firstChar, lastChar: INTEGER;
  285.                                                  VAR mode: INTEGER;
  286.                                                  VAR aStyle: TextStyle): BOOLEAN;
  287.                 { Returns TRUE if the style of the characters within the given range is wholly
  288.                 continuous. The style attributes to check are specified by mode, which has the same
  289.                 meaning as in the TextEdit call TESetStyle. Attributes which are continuous are
  290.                 returned in aStyle, with the appropriate bits set in mode. Font style attribute
  291.                 bits are individually checked across the selection range, and returned set to 1 if
  292.                 that attribute is continuous. }
  293.  
  294.                 PROCEDURE TTEView.ExtractStyles(VAR theStyles: TEStyleHandle;
  295.                                                 VAR theElements: STHandle);
  296.                 { Extract handles to style information for a TextEdit record, presumably for the
  297.                 purpose of storing the data to disk. Note that line heights can be recalculated,
  298.                 and as such don't need to be stored. }
  299.  
  300.                 FUNCTION TTEView.ExtractText: Handle;
  301.                 { For sake of completeness. Extract handle to text, presumably for the purpose of
  302.                 storing the text externally (perhaps to disk). }
  303.  
  304.                 PROCEDURE TTEView.RecalcText;
  305.                 { Tells TextEdit to recompute linestarts }
  306.  
  307.                 PROCEDURE TTEView.ScrollSelectionIntoView;
  308.                 { Scrolls the selection into view -- called after Commands are done or undone If auto
  309.                 scrolling is on, calls TESelView to do the right thing }
  310.  
  311.                 PROCEDURE TTEView.SetJustification(newJust: INTEGER;
  312.                                                    redraw: BOOLEAN);
  313.                 { Sets the TERecord to the given justification. If redraw is true then the view is
  314.                 redrawn by calling ForceRedraw. Otherwise it is assumed the called will get the
  315.                 view redrawn. }
  316.  
  317.                 PROCEDURE TTEView.SetOneStyle(theStart, theEnd, theMode: INTEGER;
  318.                                               theStyle: TextStyle;
  319.                                               redraw: BOOLEAN);
  320.                 { Sets a text style continuously over a range. In unstylish TERecords, the style is
  321.                 set across the entire record. If redraw is true then the text is redrawn. }
  322.  
  323.                 PROCEDURE TTEView.SetText(theText: Str255);
  324.                 { Convenience routine, to save from having to create a handle just to pass to
  325.                 StuffText. Note that if fSavedTEHandle already holds a saved handle, it will be
  326.                 disposed before StuffText is called. }
  327.  
  328.                 FUNCTION TTEView.SpaceForStyles(rangeStart, rangeEnd: LONGINT): BOOLEAN;
  329.                 { Returns TRUE if there is enough memory to hold the styles over the given range in
  330.                 the TERecord }
  331.  
  332.                 PROCEDURE TTEView.StuffStyles(theStyles: TEStyleHandle;
  333.                                               theElements: STHandle);
  334.                 { Installs style information, presumably fetched from disk, into the TextEdit record.
  335.                 }                                        { Installs text into the TextEdit
  336.                                                          record.Note that this destroys any
  337.                                                          existing style information -- StuffStyles
  338.                                                          should be called if styles are to be
  339.                                                          attached to this text information. }
  340.  
  341.                 PROCEDURE TTEView.StuffText(theText: Handle);
  342.                 { Installs text into the TextEdit record. Note that this destroys any existing style
  343.                 information -- StuffStyles should be called if styles are to be attached to this
  344.                 text information }
  345.  
  346.                 PROCEDURE TTEView.StuffTERects(newTERect: Rect);
  347.                 { installs "newTERect" as the dest & view rect of the TextEdit record }
  348.  
  349.                 { Printing }
  350.  
  351.                 FUNCTION TTEView.DoBreakFollowing(vhs: VHSelect;
  352.                                                   prevBreak: VCoordinate;
  353.                                                   VAR automatic: BOOLEAN): VCoordinate; OVERRIDE;
  354.                 { Computes the next page-break following 'prevBreak' in direction given by 'vhs' }
  355.  
  356.                 PROCEDURE TTEView.DoCalcViewPerPage(VAR viewPerPage: VPoint); OVERRIDE;
  357.                 { Computes how much of the view is to be allocated to each printed page }
  358.  
  359.                 PROCEDURE TTEView.DoSetPageOffset(coord: VPoint); OVERRIDE;
  360.                 { At printing time, determine the location of the 'interior' (body)
  361.                 of the page }
  362.  
  363.                 PROCEDURE TTEView.GetPrintExtent(VAR printExtent: VRect); OVERRIDE;
  364.                 { Print extent is the view's extent minus the insets. }
  365.  
  366.                 { Debugging }
  367.  
  368.                 PROCEDURE TTEView.IdentifySoftware; OVERRIDE;
  369.                 { Tells compile date of this unit }
  370.  
  371.                 PROCEDURE TTEView.Fields(PROCEDURE DoToField(fieldName: Str255;
  372.                                                              fieldAddr: Ptr;
  373.                                                              fieldType: INTEGER)); OVERRIDE;
  374.                 { Used by the Inspector and the Debugger to display the contents of this class's
  375.                 fields. }
  376.  
  377.                 END;
  378.  
  379.             TTECommand            = OBJECT (TCommand)     { A command that adds characters to, or
  380.                                                          delete characters from, a TEView }
  381.  
  382.                 fTEView:            TTEView;            { The TEView operated on }
  383.  
  384.                 fHTE:                TEHandle;            { same as fTEView's fHTE; duplicated for
  385.                                                          code efficiency }
  386.  
  387.                 fOldStart:            INTEGER;            { The beginning position of the selection at
  388.                                                          the moment just before the command was
  389.                                                          done. }
  390.                 fOldEnd:            INTEGER;            { The end position of the selection at the
  391.                                                          moment just before the command was done. }
  392.                 fOldText:            Handle;             { If fOldStart = fOldEnd, i.e., if old
  393.                                                          selection had been an insertion point,
  394.                                                          this will be NIL. Otherwise, provides a
  395.                                                          temporary home for the characters
  396.                                                          comprising the old selection }
  397.                 fOldStyles:         StScrpHandle;
  398.  
  399.                 fNewStart:            INTEGER;            { The beginning location in the Text of the
  400.                                                          new text that is added by the command, if
  401.                                                          any. }
  402.                 fNewEnd:            INTEGER;            { The ending location in the Text of the new
  403.                                                          text that is added by the command, if any.
  404.                                                          }
  405.                 fNewText:            Handle;             { A Handle to the characters added by the
  406.                                                          command }
  407.                 fNewStyles:         StScrpHandle;
  408.  
  409.                 fPadding:            Handle;             { Handle to fill size between new and old.
  410.                                                          This insures that we can always undo and
  411.                                                          redo. }
  412.                 fTextPad:            INTEGER;            { Size difference between New and Old text }
  413.                 fStylePad:            LONGINT;            { Size difference between New and Old styles
  414.                                                          }
  415.  
  416.                                 { Initialize and Free }
  417.  
  418.                 PROCEDURE TTECommand.ITECommand(itsTEView: TTEView;
  419.                                                 itsCmdNumber: CmdNumber;
  420.                                                 itsSaveText: BOOLEAN);
  421.                 { Initialize the command; if unsuccessful, exit is via Failure mechanism. }
  422.  
  423.                 PROCEDURE TTECommand.Free; OVERRIDE;
  424.                 { Free the text handles holding information needed for Undo/Redo, then Frees SELF }
  425.  
  426.                 { Command execution phase overrides }
  427.  
  428.                 PROCEDURE TTECommand.DoIt; OVERRIDE;
  429.                 { Focuses, then calls DoMainFunction }
  430.  
  431.                 PROCEDURE TTECommand.RedoIt; OVERRIDE;
  432.                 { Focuses, calls RestoreSelection to get selection right, then calls DoMainFunction
  433.                 to reinstate the changes done in DoIt which were undone by a preceding UndoIt }
  434.  
  435.                 PROCEDURE TTECommand.UndoIt; OVERRIDE;
  436.                 { Focuses, then dispatches to RemoveAdditions, ReviveDeletions, and RestoreSelection
  437.                 to accomplish the Undo }
  438.  
  439.                 { Command execution - Restoration of Selection -- called in both UNDO and REDO phases
  440.                 }
  441.  
  442.                 PROCEDURE TTECommand.RestoreSelection;
  443.                 { Set the Selection to be what it was just before the DO phase of the command was
  444.                 performed }
  445.  
  446.                 { Command execution - steps in DO and REDO phases }
  447.  
  448.                 PROCEDURE TTECommand.BanishOldText;
  449.                 { Remove text that was selected at the outset of the Do phase }
  450.  
  451.                 PROCEDURE TTECommand.InstallNewText;
  452.                 { Install the new text }
  453.  
  454.                 PROCEDURE TTECommand.DoMainFunction;
  455.                 { Forwards to the relevant methods for Do and Redo phases }
  456.  
  457.                 { Command execution - steps in UNDO phase }
  458.  
  459.                 PROCEDURE TTECommand.RemoveAdditions;
  460.                 { Remove any characters which were added by the DO phase of the command }
  461.  
  462.                 PROCEDURE TTECommand.ReviveDeletions;
  463.                 { Bring back the characters which were removed during the DO phase }
  464.  
  465.                 { Debugging }
  466.  
  467.                 PROCEDURE TTECommand.Fields(PROCEDURE
  468.                                             DoToField(fieldName: Str255;
  469.                                                       fieldAddr: Ptr;
  470.                                                       fieldType: INTEGER)); OVERRIDE;
  471.                 { Used by the Inspector and the Debugger to display the contents of this class's
  472.                 fields. }
  473.  
  474.                 END;
  475.  
  476.             TTECutCopyCommand    = OBJECT (TTECommand)    { Command for handling Cut & Copy for the
  477.                                                          TEView. }
  478.                 fClipCreated:        BOOLEAN;            { Clipboard view created OK }
  479.  
  480.                                 { Creation and Destruction }
  481.  
  482.                 PROCEDURE TTECutCopyCommand.ITECutCopyCommand(itsTEView: TTEView;
  483.                                                               itsCmdNumber: CmdNumber);
  484.                 { Initializes the command }
  485.  
  486.                 PROCEDURE TTECutCopyCommand.Free; OVERRIDE;
  487.                 { Free the command }
  488.  
  489.                 { Command execution }
  490.  
  491.                 PROCEDURE TTECutCopyCommand.DoIt; OVERRIDE;
  492.                 { Launches a TEView for installation in the Clipboard, then calls DoMainFunction }
  493.  
  494.                 PROCEDURE TTECutCopyCommand.ReviveDeletions; OVERRIDE;
  495.                 { Bring back the characters which were removed during the DO phase; called during
  496.                 UNDO phase }
  497.  
  498.                 { Debugging }
  499.  
  500.                 PROCEDURE TTECutCopyCommand.Fields(PROCEDURE
  501.                                                    DoToField(fieldName: Str255;
  502.                                                              fieldAddr: Ptr;
  503.                                                              fieldType: INTEGER)); OVERRIDE;
  504.                 { Used by the Inspector and the Debugger to display the contents of this class's
  505.                 fields. }
  506.  
  507.                 END;
  508.  
  509.             TTEPasteCommand     = OBJECT (TTECommand)    { Command that handles Pasting for the
  510.                                                          TEView. }
  511.  
  512.             { Initialization }
  513.                 PROCEDURE TTEPasteCommand.ITEPasteCommand(itsTEView: TTEView);
  514.                 { Initialize the command; if unsuccessful, signalled by Failure mechanism }
  515.  
  516.                 { Debugging }
  517.  
  518.                 PROCEDURE TTEPasteCommand.Fields(PROCEDURE
  519.                                                  DoToField(fieldName: Str255;
  520.                                                            fieldAddr: Ptr;
  521.                                                            fieldType: INTEGER)); OVERRIDE;
  522.                 { Used by the Inspector and the Debugger to display the contents of this class's
  523.                 fields. }
  524.  
  525.                 END;
  526.  
  527.             TTEStyleCommand     = OBJECT (TTECommand)    { Command for applying a new style to the
  528.                                                          TEView. }
  529.  
  530.             { These two fields are only used in non-styled TextEdit records }
  531.                 fMode:                INTEGER;            { Mode for style change }
  532.                 fOldTextStyle:        TextStyle;            { The original text style }
  533.                 fNewTextStyle:        TextStyle;            { What we're replacing it with }
  534.  
  535.                                 { Initialization }
  536.  
  537.                 PROCEDURE TTEStyleCommand.ITEStyleCommand(itsTEView: TTEView;
  538.                                                           itsNewStyle: TextStyle;
  539.                                                           itsCmdNumber: CmdNumber;
  540.                                                           itsMode: INTEGER);
  541.                 { Initialize the command; if unsuccessful, signalled by Failure mechanism }
  542.  
  543.                 { Command execution }
  544.  
  545.                 PROCEDURE TTEStyleCommand.InstallOneStyle(newStyl: TextStyle);
  546.                 { Installs one style over entire record - for use with old TextEdit }
  547.  
  548.                 PROCEDURE TTEStyleCommand.InstallManyStyles(newStyls: StScrpHandle);
  549.                 { Installs styles over selection range - for use with styled TextEdit }
  550.  
  551.                 PROCEDURE TTEStyleCommand.DoIt; OVERRIDE;
  552.                 { Applies style to selection range }
  553.  
  554.                 PROCEDURE TTEStyleCommand.UndoIt; OVERRIDE;
  555.                 { Undoes the action performed by DoIt. }
  556.  
  557.                 PROCEDURE TTEStyleCommand.RedoIt; OVERRIDE;
  558.                 { Calls DoIt. }
  559.  
  560.                 { Debugging }
  561.                 PROCEDURE TTEStyleCommand.Fields(PROCEDURE
  562.                                                  DoToField(fieldName: Str255;
  563.                                                            fieldAddr: Ptr;
  564.                                                            fieldType: INTEGER)); OVERRIDE;
  565.                 { Used by the Inspector and the Debugger to display the contents of this class's
  566.                 fields. }
  567.  
  568.                 END;
  569.  
  570.             TTETypingCommand    = OBJECT (TTECommand)    { The command that handles typing in a
  571.                                                          TEView. }
  572.                 fCompleted:         BOOLEAN;            { Indicates whether further keystrokes will
  573.                                                          be extensions to this command (FALSE) or
  574.                                                          whether the command has already been
  575.                                                          completed (TRUE) }
  576.                 fFirstChar:         Char;                { First character typed }
  577.  
  578.                                 { Creation and destruction }
  579.  
  580.                 PROCEDURE TTETypingCommand.ITETypingCommand(itsTEView: TTEView;
  581.                                                             itsFirstChar: Char);
  582.                 { Initialize the command; if not successful, exit is via Failure mechanism }
  583.  
  584.                 PROCEDURE TTETypingCommand.Free; OVERRIDE;
  585.                 { Deallocate the command and dependent structures }
  586.  
  587.                 { Command processing }
  588.  
  589.                 PROCEDURE TTETypingCommand.DoNormalChar(aChar: Char);
  590.                 { Handle any typed character except a backspace }
  591.  
  592.                 PROCEDURE TTETypingCommand.BkSpcLeft(theText: Handle;
  593.                                                      curStart: INTEGER);
  594.                 { Handle backspace to the left of the original selection }
  595.  
  596.                 PROCEDURE TTETypingCommand.BkSpcRight(theText: Handle;
  597.                                                       curStart: INTEGER);
  598.                 { Handle backspace to the right of the original selection }
  599.  
  600.                 PROCEDURE TTETypingCommand.FwdDelete(theText: Handle;
  601.                                                      curStart, curEnd: INTEGER);
  602.                 {  Handle forward delete }
  603.  
  604.                 PROCEDURE TTETypingCommand.AddCharacter(aChar: Char);
  605.                 { Add another character to an already-launched TETypingCommand }
  606.  
  607.                 PROCEDURE TTETypingCommand.DoIt; OVERRIDE;
  608.                 { First processing for command; adds first character }
  609.  
  610.                 PROCEDURE TTETypingCommand.RedoIt; OVERRIDE;
  611.                 { Handles undoing forward backspace}
  612.  
  613.                 PROCEDURE TTETypingCommand.UndoIt; OVERRIDE;
  614.                 { Process undo typing }
  615.  
  616.                 PROCEDURE TTETypingCommand.CompleteTyping;
  617.                 { Mark as no more typing allowed and fix up style scrap, if any }
  618.  
  619.                 { Debugging }
  620.  
  621.                 PROCEDURE TTETypingCommand.Fields(PROCEDURE
  622.                                                   DoToField(fieldName: Str255;
  623.                                                             fieldAddr: Ptr;
  624.                                                             fieldType: INTEGER)); OVERRIDE;
  625.                 { Used by the Inspector and the Debugger to display the contents of this class's
  626.                 fields. }
  627.  
  628.                 END;
  629.  
  630. {--------------------------------------------------------------------------------------------------}
  631.  
  632.         VAR
  633.             gDefClikLoopProc:    ProcPtr;                { Standard TextEdit click loop routine }
  634.  
  635.         { The following are considered private, but appear in the interface in case you need to
  636.         override a method that uses one of these. }
  637.  
  638.             pCurrTEView:        TTEView;                { For the benefit of ClikLoopForTTEView only }
  639.             {$IFC qDebug}
  640.             pTEIntenseDebugging: BOOLEAN;
  641.             {$ENDC}
  642.  
  643. {--------------------------------------------------------------------------------------------------}
  644.  
  645.         PROCEDURE InitUTEView;
  646.         { Initialize TEView unit. }
  647.  
  648.         PROCEDURE SetSelect(theStart, theEnd: INTEGER;
  649.                             hTE: TEHandle);
  650.         { For those times when we don't want the selection range hilited when changed }
  651.  
  652.         FUNCTION ClickLoopForTTEView: BOOLEAN;
  653.         { Called from TextEdit when the mouse is down forwards to TTEView.ClikLoop so that
  654.         autoscrolling may be done. }
  655.  
  656.         PROCEDURE DumpTERecord(aTEH: TEHandle);
  657.         { writes salient information about the TERecord out to the Debug window }
  658.  
  659.         PROCEDURE DumpTTECommand(theTTECommand: TTECommand);
  660.         { writes TTECommand info out to Debug window }
  661.         {$ENDC}
  662.  
  663.         {$IFC NOT UsingIncludes}
  664. END.
  665. {$ENDC}
  666.